import 'dart:math' as math;
void main() {
  // print('ssss');
  List arr = List.empty(growable: true);
  // print(arr.reversed);
  // var ss;
  // print({...?ss});
  int a = 33;
  Set set = {1, 23, 4};
  Set set2 = Set();
  set.addAll({7, 8});
  Map obj = {'name': 'zhangs'};
  Map obj2 = Map();
  //key存在则不赋值 否则赋值
  // obj2.putIfAbsent(key, () => null)
  dynamic foo = false;
  var bar = foo ??= 2;
  // print(foo);
//  print(bar );
  set
    ..add(4)
    ..add(6);
  Anima a1 = const Anima(1, 2);
  Anima a2 = const Anima(1, 2);
  // print(a2 == a1);
  // Person p = new Person('zhangsan');
  // print(p.name);
  // List<Color> colors = Color.values;
  // print(Color.black.index);
  // print(math.pi);
  String num = '222';
  print(num.parseInt());
}

class Anima {
  final a, b;
  const Anima(this.a, this.b);
}
//工厂构造器
class Person {
  String name;
  static Person instance = Person.myName('lisi');
  factory Person(String name){
    if(Person.instance == null){
      Person.instance = new Person.myName(name);
    }
    return Person.instance;
  }
  Person.myName(this.name);
  String getName(){
    return name;
  }
}
//重定向构造器 初始化列表
class Point {
  double x, y, z;
  Point(this.x,this.y,this.z);
  Point.twoD(double x, double y): this(x, y, 0);
}

class Father {
  String job;
  static String name = 'zhangsan';
  static getname ({required String  age  }){
    return name;
  }
  Father(this.job);
  num _count = 3; //库内私有 同一文件内 子类也可以访问 
}
class Son extends Father{
  Son(String job):super(job);
  // @Deprecated('nouse')
  getname(){
    return super._count; //同一库内 this._count也可访问
  }
}
//泛型
class Fan<T extends Set> {}

//枚举
enum Color {red, green, black}
//extension 
extension StringExtension on String {
  parseInt() => int.parse(this);
}